package day01;

import java.util.*;

public class ReviewLessons03 {
    public static void main(String[] args) {
        int[] i = {3,6,5,1,2,8,9,5,6,4,9,2};
        for (int j = 0; j < i.length; j++) {
            System.out.println();
            for (int k = 1+j; k < i.length ; k++) {
                if (i[j]>i[k]){
                    int a=i[j];
                    i[j] = i[k];
                    i[k] = a;
                }
                System.out.println(Arrays.toString(i));
            }
            System.out.println();
        }

        int[] a = {5,6,9,2,8,1,3,7,0,1,6,2,8,5};
        for (int j = 1; j < a.length; j++) {
            int n = j;
            while (n>0){
                if (a[n]<a[n-1]){
                    int t = a[n];
                    a[n] = a[n-1];
                    a[n-1] = t;
                    n--;
                    System.out.println(Arrays.toString(a));
                }else{
                    break;
                }
            }
            System.out.println();
        }




        /*
        int[] i = {6,5,8,2,3,6,8,4,1,5};
        for (int j = 0; j < i.length-1; j++) {
            for (int k = 0; k < i.length-1; k++) {
                if (i[k]>i[k+1]){
                    int a = i[k];
                    i[k]=i[k+1];
                    i[k+1] = a;
                }
            }
            System.out.println(Arrays.toString(i));
        }
         */

        /*
        System.out.println("石头剪刀布游戏，是个男人就来挑战");
        Scanner scan = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        list.add("石头");
        list.add("剪刀");
        list.add("布");
        String s1;
        int score = 0;
        int score1 = 0;
        while (true){
            String s = scan.nextLine();
            Random ran = new Random();
            Integer integer = ran.nextInt(3);
            s1 = list.get(integer);
            System.out.println(s1);
            if (list.contains(s)){
                if (s1.equals(s)){
                    System.out.println("打平了");
                }else{
                    if ("石头".equals(s1)&&"剪刀".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("石头".equals(s1)&&"布".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }else if ("剪刀".equals(s1)&&"布".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("剪刀".equals(s1)&&"石头".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }else if ("布".equals(s1)&&"石头".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("布".equals(s1)&&"剪刀".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }
                }
            }else{
                System.out.println("请认真对待游戏");
            }
            System.out.println("我的分"+score+"系统的分"+score1);
            if (score==5||score1==5){
                break;
            }
        }
        if (score>score1){
            System.out.println("恭喜你赢了，别高兴的太早");
        }else{
            System.out.println("恭喜你输了，再接再厉吧!");
        }
         */

        /*
        Scanner scan = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        list.add("石头");
        list.add("剪刀");
        list.add("布");
        String s1;
        int score = 0;
        int score1=0;
        while (true){
            Random ran = new Random();
            Integer integer = ran.nextInt(3);
            String s = scan.nextLine();
            s1 = list.get(integer);
            System.out.println("系统:"+s1);
            if (list.contains(s)){
                if (s1.equals(s)){
                    System.out.println("打平了");
                }else{
                    if ("石头".equals(s1)&&"剪刀".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("石头".equals(s1)&&"布".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }else if ("剪刀".equals(s1)&&"布".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("剪刀".equals(s1)&&"石头".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }else if ("布".equals(s1)&&"石头".equals(s)){
                        System.out.println("输了");
                        score1++;
                    }else if ("布".equals(s1)&&"剪刀".equals(s)){
                        System.out.println("赢了");
                        score++;
                    }
                }
            }else{
                System.out.println("请认真等待，好好玩");
            }
            System.out.println("我的分:"+score+",系统的分:"+score1);
            if (score==5||score1==5){
                break;
            }
        }
        if (score>score1){
            System.out.println("恭喜你赢了");
        }else{
            System.out.println("很遗憾，你输了");
        }
         */

        /*
        Scanner scan = new Scanner(System.in);
        List<String> s = new ArrayList<>();
        s.add("石头");
        s.add("剪刀");
        s.add("布");
        String s1;
        int score = 0;
        int score1 = 0;
        System.out.println("该你了");
        while (true){
            Random ran = new Random();
            Integer integer = ran.nextInt(3);
            String s2 = scan.nextLine();
            s1 = s.get(integer);
            System.err.println(s1);
            if (s.contains(s2)){
                if (s1.equals(s2)){
                    System.out.println("平局");
                }else{
                    if ("石头".equals(s1)&&"布".equals(s2)){
                        System.out.println("你赢了");
                        score++;
                    }else if("石头".equals(s1)&&"剪刀".equals(s2)){
                        System.out.println("你输了");
                        score1++;
                    }else if ("剪刀".equals(s1)&&"石头".equals(s2)){
                        System.out.println("你赢了");
                        score++;
                    }else if ("剪刀".equals(s1)&&"布".equals(s2)){
                        System.out.println("你输了");
                        score1++;
                    }else if ("布".equals(s1)&&"石头".equals(s2)){
                        System.out.println("你输了");
                        score1++;
                    }else if ("布".equals(s1)&&"剪刀".equals(s2)){
                        System.out.println("你赢了");
                        score++;
                    }
                }
            }else{
                System.out.println("请认真玩游戏");
            }
            System.out.println("你的分:"+score+",系统的分:"+score1);
            if (score==3||score1==3){
                break;
            }
        }
        if (score>score1){
            System.out.println("恭喜你赢了");
        }else{
            System.out.println("很遗憾，再接再厉");
        }
         */

        /*
        int count=0;
        for (float y=2.5f;y>-2.0f;y-=0.12f) {
            try {
                Thread.sleep(400);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            for (float x = -2.3f; x < 2.3f; x += 0.041f) {
                float a = x * x + y * y - 4f;
                if ((a * a * a - x * x * y * y * y) < -0.0f) {
                    String str = "I LOVE YOU!";
                    int num1 = count % str.length();
                    System.err.print(str.charAt(num1));
                    count++;
                } else {
                    System.err.print(" ");
                }
            }
            System.err.println();
        }
         */
    }
}
